package com.aurora.source.authority.presenter;

import android.content.Context;

import com.aurora.source.authority.bean.PersonAuthAddBean;
import com.aurora.source.authority.view.IPersonAuthAddView;
import com.aurora.source.base.BaseBean;
import com.aurora.source.base.BasePresenter;
import com.aurora.source.constant.AuroraConstants;
import com.aurora.source.util.netutil.SubscriberObserver;

import java.io.File;
import java.util.Map;

public class PersonAuthAddPresenter extends BasePresenter<IPersonAuthAddView> {

    public PersonAuthAddPresenter(IPersonAuthAddView baseView) {
        super(baseView);
    }

    public void affirmAdd(Context context, Map<String, String> params, File cardJust, File cardAgainst) {
        requestMethod.affirmAdd(params,cardJust,cardAgainst, new SubscriberObserver<BaseBean<PersonAuthAddBean>>(context,"正在加载中...") {
            @Override
            public void onSuccess(BaseBean<PersonAuthAddBean> personAuthAddBean) {
                if (personAuthAddBean.getCode().equals(AuroraConstants.REQUEST_SUCCESS)) {
                    baseView.onPersonAuthAddSuccess(personAuthAddBean.getMsg());
                } else {
                    baseView.onPersonAuthAddFail(personAuthAddBean.getMsg());
                }
            }

            @Override
            public void onError(String msg) {
                baseView.onPersonAuthAddFail(msg);
            }

            @Override
            public void onFinish() {

            }
        });

    }
}
